import { getToken } from '@/utils/auth'
import request from '@/utils/request'
// 登录
export function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}
//获取基本信息
export function getInfo() {
  return request({
    url: '/user/info',
    method: 'get',
  })
}
//登出
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}
//查询所有用户
export function selectAll() {
  return request({
    url: '/user',
    method: 'get'
  })
}
//查询用户
export function selectUserById(id) {
  return request({
    url: `/user/${id}`,
    method: 'get'
  })
}
//模糊查询用户
export function selectUsersByName(name) {
  return request({
    url: `/user/selectUsersByName`,
    method: 'get',
    params: {'name':name}
  })
}
//添加用户
export function addUser(user) {
  return request({
    url: '/user',
    method: 'post',
    data: user
  })
}
//修改用户
export function updateUser(user) {
  return request({
    url: '/user',
    method: 'put',
    data: user
  })
}
//删除用户
export function deleteUser(id) {
  return request({
    url: `/user/${id}`,
    method: 'delete'
  })
}
//批量删除用户
export function deleteUsers(ids) {
  return request({
    url: `/user/delete`,
    method: 'delete',
    data: ids
  })
}
//分页查询
export function pageSelect(query) {
  return request({
    url: `/user/page`,
    method: 'post',
    data: query
  })
}




